<?php


namespace frontend\controllers\yk;

use frontend\models\yk\User;
use yii\web\Controller;
use yii\web\Request;

class UserController extends Controller
{
    public $enableCsrfValidation = false;

    /**
     * @param Request $request
     * @return false|string
     * 登录接口
     */
    public function actionUser(Request $request)
    {
//        $sql='select * from 2008a_user';
//        $results=User::findBySql($sql)->all();
//        var_dump($results['username']);die();
//        print_r($results);die();
        $data=$request->post();
        $username=User::find('username',$data['username']);
        if ($data['username']!=$username){
            return json_encode(['code'=>200,'msg'=>"用户名正确",'data'=>[]]);
        }else{
            return json_encode(['code'=>201,'msg'=>"用户名错误",'data'=>[]]);
        }


    }

}